package mrusanov.player

import util.Random
import java.util.{Calendar, Date}

class Injury(val date:Date, val physicalFormLossAfterInjury:Int, val daysToRecover:Int) {

  def isOver(now:Date) = daysLeft(now) >= daysToRecover

  def daysLeft(now:Date) = (now.getTime - date.getTime) / (1000 * 60 * 60 * 24)

}

object LightInjury {
  def apply(date:Date) = new Injury(date, Random.nextInt(10) + 5, Random.nextInt(10) + 5)
}

object MediumInjury {
  def apply(date:Date) = new Injury(date, Random.nextInt(30) + 15, Random.nextInt(30) + 15)
}

object HardInjury {
  def apply(date:Date) = new Injury(date, Random.nextInt(90) + 45, 100)
}